<template>
	<view class="search">
		<input type="text" v-model="kw" placeholder="请输入测评名称" @confirm="searchAction"/>
		<image src="../../static/icon-search.png" mode="aspectFit" @click="searchAction"></image>
	</view>
</template>

<script>
	export default {
		props: [
			'keywords'
		],
		data() {
			return {
				kw: ''
			}
		},
		watch: {
			keywords(val, oldVal) {
				this.kw = val;
			}
		},
		methods: {
			searchAction() {
				this.$emit('searchEvent', this.kw);
			}
		}
	}
</script>

<style lang="scss">
	$searchBg: #f8f8f9;
	$border: #f1f1f1;
	.search {
		background-color: $searchBg;
		border: 1px solid $border;
		display: flex;
		align-items: center;
		margin: 32rpx 22rpx 22rpx;
		padding: 8rpx 22rpx;
		input {
			flex: 1;
			min-width: 0;
			padding: 6rpx 10rpx;
			font-size: 26rpx;
			line-height: 0;
		}
		image {
			width: 32rpx;
			height: 32rpx;
		}
	}
</style>
